package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.StoryMemberComment;
import com.addplus.townmall.server.api.model.town.expand.StoryMemberCommentExpand;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 商城文章评论表 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-08-27
 */
public interface StoryMemberCommentMapper extends BaseAddMapper<StoryMemberComment> {
    @Select("select a.id, b.nick_name, b.head_portrait,a.is_sort, a.context, a.gmt_create " +
            "from story_member_comment as a, member as b where " +
            "a.story_article_id=#{storyId} and a.is_violation = 0 and a.is_delete = 0 and " +
            "a.member_id = b.id order by a.gmt_create desc")
    List<StoryMemberCommentExpand> getCommentPage(Page page, @Param("storyId") Integer storyId);

}
